package dms_system_gui;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.*;

/**
 * @file Employees.java
 * @version 0.1
 * @author James Dibble 10009689
 */
@Entity
@Table(name = "employees", catalog = "dms", schema = "")
@NamedQueries({
    @NamedQuery(name = "Employees.findAll", query = "SELECT e FROM Employees e"),
    @NamedQuery(name = "Employees.findById", query = "SELECT e FROM Employees e WHERE e.id = :id"),
    @NamedQuery(name = "Employees.findByUserid", query = "SELECT e FROM Employees e WHERE e.userid = :userid"),
    @NamedQuery(name = "Employees.findByCostPerPbrHr", query = "SELECT e FROM Employees e WHERE e.costPerPbrHr = :costPerPbrHr")})
public class Employees implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "userid")
    private int userid;
    @Basic(optional = false)
    @Column(name = "cost_per_pbr_hr")
    private long costPerPbrHr;
    // <editor-fold defaultstate="collapsed" desc="Attributes">
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Constructors">
    public Employees() {
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    // </editor-fold>

    public Employees(Integer id) {
        this.id = id;
    }

    public Employees(Integer id, int userid, long costPerPbrHr) {
        this.id = id;
        this.userid = userid;
        this.costPerPbrHr = costPerPbrHr;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public int getUserid() {
        return userid;
    }

    public void setUserid(int userid) {
        int oldUserid = this.userid;
        this.userid = userid;
        changeSupport.firePropertyChange("userid", oldUserid, userid);
    }

    public long getCostPerPbrHr() {
        return costPerPbrHr;
    }

    public void setCostPerPbrHr(long costPerPbrHr) {
        long oldCostPerPbrHr = this.costPerPbrHr;
        this.costPerPbrHr = costPerPbrHr;
        changeSupport.firePropertyChange("costPerPbrHr", oldCostPerPbrHr, costPerPbrHr);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employees)) {
            return false;
        }
        Employees other = (Employees) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "dms_system_gui.Employees[ id=" + id + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
}
